package ReferenceCasting_package;

class Animal
{
	public void show()
	{
		System.out.println("Animal show");
	}
}
class Dog extends Animal
{
	public void show()
	{
		System.out.println("Dog show");
	}
	public void display()
	{
		System.out.println("Dog display");
	}
}

public class test1 
{
	public static void main(String[] args) 
	{
		Animal a = new Animal();
		//a.show();
		
		Animal a1 = new Dog();
		//a1.show();
		
		Dog d = new Dog();
		//d.show();
		//d.display();
		
	    // Dog g  = ((Dog)a);
		//g.show();
		
		//a.display();
		
		//((Dog)a1).display();
		//((Dog)a1).show();
		
		((Animal)d).show();
		//((Animal)d).display();
		
		Animal [] arr = {new Animal(), new Dog()} ;
		
		for(Animal ar : arr)
		{
			ar.show();
			//if(ar instanceof Dog){ar.display();};
			if(ar instanceof Dog){((Dog) ar).display();};
		}
	}

}
